home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / libq / IIsyserr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  970 b   |  53 lines

  1. # include    <stdio.h>
  2. # include    <sccs.h>
  3.  
  4. SCCSID(@(#)IIsyserr.c    8.1    12/31/84)
  5.  
  6.  
  7. /*
  8. **  SYSERR -- SYStem ERRor message print and abort
  9. **
  10. **    Syserr acts like a printf with up to five arguments.
  11. **
  12. **    If the first argument to syserr is not zero,
  13. **    the message "SYSERR:" is prepended.
  14. **
  15. **    If the extern variable `IIproc_name' is assigned to a
  16. **    string, that string is prepended to the message.
  17. **
  18. **    All arguments must be null-terminated.
  19. **
  20. **    The function pointed to by `Exitfn' is then called.
  21. **    It is initialized to be `exit'.
  22. */
  23.  
  24. extern char    *IIproc_name;
  25.  
  26. IIsyserr(pv)
  27. char    *pv;
  28. {
  29.     int        pid;
  30.     register char    **p;
  31.     extern int    errno;
  32.     register int    usererr;
  33.  
  34.     p = &pv;
  35.     printf("\n");
  36.     usererr = pv == 0;
  37.  
  38.     if (!usererr)
  39.     {
  40.         if (IIproc_name)
  41.             printf("%s ", IIproc_name);
  42.         printf("SYSERR: ");
  43.     }
  44.     else
  45.         p++;
  46.     printf(p[0], p[1], p[2], p[3], p[4], p[5]);
  47.     printf("\n");
  48.     if (!usererr && errno)
  49.         printf("\tsystem error %d\n", errno);
  50.     fflush(stdout);
  51.     exit (-1);
  52. }
  53.